package cl.sodexo.com.action;

import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpServletResponse;

import org.apache.log4j.Logger;
import org.apache.struts.action.Action;
import org.apache.struts.action.ActionForm;
import org.apache.struts.action.ActionForward;
import org.apache.struts.action.ActionMapping;

import cl.sodexo.com.utils.Constantes;

/**
 * @author psep
 *
 */
public class MenuAction extends Action{
	
	private static final Logger logger = Logger.getLogger(MenuAction.class);
	
	/**
	 * @return ActionForward
	 */
	public ActionForward execute(ActionMapping mapping, ActionForm form, 
			HttpServletRequest request, HttpServletResponse response) throws Exception {		
		if(!(Boolean) request.getSession().getAttribute(Constantes.SESSION)){
			logger.info("Sesión expirada");
			return mapping.findForward(Constantes.ERROR);
		}else{
			logger.info("Sesión activa");
			return mapping.findForward(Constantes.SUCCESS);
		}
	}

}
